﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Hotel
{
    public partial class ExpiredRoom : Form
    {
        public ExpiredRoom()
        {
            InitializeComponent();
        }
        CNDatabase cnDb = new CNDatabase();
        private void ExpiredRoom_Load(object sender, EventArgs e)
        {

            loadData();
        }
        private void loadData() {
            string qr = "select Fullname, Customer.PhoneNumber, Room.NameRoom, EndDay from Room "
               + " join ListRoomBooking on Room.IDRoom=ListRoomBooking.IDRoom "
               + " join BookingLog on BookingLog.IDBookingLog=ListRoomBooking.IDBookingLog "
               + " join Customer on BookingLog.IdentificationNumber=Customer.IdentificationNumber "
               + " and CONVERT(date,EndDay, 103) = DATEADD(day," + txtNumber.Text + ",CONVERT(date, GETDATE(), 103))"
               + " and cost=0";
            grvExpried.DataSource = cnDb.getDataset(qr).Tables[0];
        }
        private void btCheck_Click(object sender, EventArgs e)
        {
            loadData();
        }
    }
}
